﻿using System.Web.Mvc;
using Sportsbook.Domain.Models.BetSlips;
using Sportsbook.Domain.Repositories;

namespace Sportsbook.Website.Controllers
{
    public class BetSlipController : Controller
    {
        private readonly IBetSlipsRepository repository;

        public BetSlipController(IBetSlipsRepository repository)
        {
            this.repository = repository;
        }

        public ActionResult Index()
        {
            var model = repository.Get("cesarbmx");
            return View(model);
        }
        [HttpPost]
        public void AddTicket(ITicket ticket)
        {
            var betSlip = repository.Get("cesarbmx");
            betSlip.Tickets.Add(ticket);
            repository.Save(betSlip, "cesarbmx");
        }
    }
}
